package com.hsp.Demo_03_object;

public class Demo_18 {
    public static void main(String[] args) {
        /*
       7、设计一个Dog类，有名字、颜色和年龄属性，定义输出方法show()显示其信息，并创建对象，进行测试。
         */
        Dog dog = new Dog("小王", "红色", 18);
        dog.show();
    }
}

class Dog{
    public String name;
    public String color;
    public int age;

//    public Dog(){};

    public Dog(String name, String color, int age){
        this.name = name;
        this.color = color;
        this.age = age;
    }

    public void show(){
        System.out.println("这只狗的名字是：" + this.name + ", 颜色是：" + this.color + "," +
                " 目前" + this.age + "岁了");
    }
}
